<?php
/**
 * Html View
 * @author Leo 2010-09-08
 *
 */
class HtmlView extends View {
	const EXT = '.html';
	/**
	 * 绘制
	 * @param array $data
	 * @param Response $response
	 * @param string $tpl
	 * @return string
	 */
	public function render($data, $response, $tpl = '') {
		global $LAYOUT_NAME, $APPLICATION, $ACTION_NAME;
		$tpl .= HtmlView::EXT;
		if (is_file ( $tpl )) {
			extract ( $data );
			@ob_start ();
			include $tpl;
			$content = @ob_get_contents ();
			@ob_end_clean ();
			return $content;
		} else {
			$response->error ( 'the view template ' . $tpl . ' is not found', 404 );
		}
	}
	public function setHeader() {
		@header ( 'Content-Type: text/html' );
	}
}